var e = require("../../config.js");

Component({
    properties: {
        mode: {
            type: String,
            value: "pop"
        },
        captchaType: {
            type: String,
            value: "clickWord"
        },
        imgSize: {
            type: Object,
            value: {
                width: "310px",
                height: "155px"
            }
        },
        barHeight: {
            type: String,
            value: "40px"
        },
        vSpace: {
            type: String,
            value: "5"
        }
    },
    data: {
        captchaOpt: {},
        show: !1
    },
    methods: {
        switchType: function() {
            this.triggerEvent("switchType");
        },
        show: function() {
            var t = this;
            this.setData({
                captchaOpt: {
                    baseUrl: e.config.base_url,
                    mode: this.properties.mode,
                    captchaType: this.properties.captchaType,
                    imgSize: this.properties.imgSize,
                    barHeight: this.properties.barHeight,
                    vSpace: this.properties.vSpace,
                    success: function(e) {
                        console.log(e), t.successCaptcha(e);
                    },
                    fail: function(e) {
                        console.log(e), t.errorCaptcha(e);
                    }
                }
            }), this.setData({
                show: !0
            }), this.selectComponent(".demo1").show();
        },
        successCaptcha: function(e) {
            this.triggerEvent("sendSuccess", e);
        },
        errorCaptcha: function(e) {
            this.triggerEvent("sendError", e);
        }
    }
});